// component/pay/pay.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    isnavigator:{
      type:Boolean,
      value:false
    },
    finsTotalprice:{
      type:String,
      value:0
    },
    token:{
      type:String,
      value:0
    },
    orderno:{
      type:String,
      value:0
    },
    isorderno:{
      type:String,
      value:0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    MeetName:'常规会议',
    Joins:'0'
  },

  /**
   * 组件的方法列表
   */
  methods: {
    /******关闭********/
    isTrue(e){
      let that = this;
      that.setData({
        isnavigator:false
      })
    },
    
    gettitle(e){
      let that = this
      that.setData({
        MeetName:e.detail.value
      })
    },
    getnum(e){
      console.log(e)
      let that = this
      let Joins = e.detail.value;
      if(!(/(^[0-9]*$)/.test(Joins))){
        wx.showToast({ title: '参会人数只能输入数字！', icon: 'none', duration: 1500 })
      }else{
        that.setData({
          Joins:e.detail.value
        })
      }
      
    },
    selectItem(e) {
      let index = e.currentTarget.dataset.index;
      let value = e.currentTarget.dataset.value;
      if(index=="1"){
          var onisTrue = true;
       }
      //console.log(index);
      let weixin = this.data.weixin;
      for(let i = 0; i<weixin.length; i++){
        weixin[i].select = false;
      }
      weixin[index].select = !weixin[index].select;
  
      this.setData({
        weixin:weixin,
        baytype:value,
       
      })
    },

    /*from表单提交*/
    onCheckbox(e) {
      let that = this
      wx.request({
        url: 'https://www.yulonging.com/dwweb/wxapi.ashx?cmd=saveorder',
        data: {
          cmd: 'SetMeetName',
          token:  wx.getStorageSync('token'),
          OrderNo:that.properties.isorderno,
          MeetName:that.data.MeetName,
          Joins:that.data.Joins
        },
        method: "get",
        header: {
          'content-type': 'application/json' // 默认值
        },
        success (data) {
          console.log(data)
          if(data.data.STATUS=='Success'){
              that.setData({
                list: data.data.DATA,
                isnavigator:false
              })
              wx.navigateTo({
                //url: '../unusedorder/unusedorder?OrderNo='+that.properties.isorderno
                url:'../Invitationandsharing/Invitationandsharing?OrderNo='+that.properties.isorderno
              })  
            }else{
              wx.showToast({
                title:data.data.DESC,
                icon: 'error',
                duration: 2000
              })
            }
          }
      })
     
    },



  }
})
